<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <meta name="generator" content="VuePress 2.0.0-beta.25">
    <link rel="icon" href="/eurynome-cloud/images/logo.png"><meta name="keywords" content="Eurynome Cloud,微服务,Spring Boot,Spirng Cloud,Spring Cloud Alibaba,Spring Security,OAuth2,Nacos,Skywalking"><script>var _hmt = _hmt || [];
            (function() {
                var hm = document.createElement("script");
                hm.src = "https://hm.baidu.com/hm.js?376190fed0f613f413a39d7aa19f387d";
                var s = document.getElementsByTagName("script")[0];
                s.parentNode.insertBefore(hm, s);
            })();</script><title>多环境配置 | Eurynome Cloud</title><meta name="description" content="Eurynome Cloud, 在线文档, 微服务, 微服务架构, Spring Boot，Spring Cloud，Spring Cloud Alibaba, Spring Security, OAuth 2, Skywalking, Nacos">
    <link rel="preload" href="/eurynome-cloud/assets/js/runtime~app.64d35c83.js" as="script"><link rel="preload" href="/eurynome-cloud/assets/css/styles.03bfbc71.css" as="style"><link rel="preload" href="/eurynome-cloud/assets/js/567.94e28fdc.js" as="script"><link rel="preload" href="/eurynome-cloud/assets/js/app.a2a09456.js" as="script">
    <link rel="stylesheet" href="/eurynome-cloud/assets/css/styles.03bfbc71.css">
  </head>
  <body>
    <div id="app"><!--[--><div class="theme-container"><header class="navbar"><div class="toggle-sidebar-button" title="toggle sidebar" aria-expanded="false" role="button" tabindex="0"><div class="icon" aria-hidden="true"><span></span><span></span><span></span></div></div><span><a href="/eurynome-cloud/" class=""><img class="logo" src="/eurynome-cloud/images/logo.png" alt="Eurynome Cloud"><span class="site-name can-hide">Eurynome Cloud</span></a></span><div class="navbar-links-wrapper" style=""><!--[--><!--]--><nav class="navbar-links can-hide"><!--[--><div class="navbar-links-item"><a href="/eurynome-cloud/documents/" class="nav-link router-link-active" aria-label="指南"><!--[--><!--]--> 指南 <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/eurynome-cloud/documents-athena/" class="nav-link" aria-label="单体版"><!--[--><!--]--> 单体版 <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/eurynome-cloud/microservices/" class="nav-link" aria-label="微服务技术栈"><!--[--><!--]--> 微服务技术栈 <!--[--><!--]--></a></div><div class="navbar-links-item"><div class="dropdown-wrapper"><button class="dropdown-title" type="button" aria-label="了解更多"><span class="title">了解更多</span><span class="arrow down"></span></button><button class="mobile-dropdown-title" type="button" aria-label="了解更多"><span class="title">了解更多</span><span class="right arrow"></span></button><!--[--><ul style="display:none;" class="nav-dropdown"><!--[--><li class="dropdown-item"><!--[--><h4 class="dropdown-subtitle"><span>延伸</span></h4><ul class="dropdown-subitem-wrapper"><!--[--><li class="dropdown-subitem"><a href="/eurynome-cloud/basic-knowledge/" class="nav-link" aria-label="了解基础知识"><!--[--><!--]--> 了解基础知识 <!--[--><!--]--></a></li><!--]--></ul><!--]--></li><li class="dropdown-item"><!--[--><h4 class="dropdown-subtitle"><span>帮助</span></h4><ul class="dropdown-subitem-wrapper"><!--[--><li class="dropdown-subitem"><a class="nav-link external" href="https://gitee.com/herodotus/eurynome-cloud/issues" rel="noopener noreferrer" target="_blank" aria-label="我要提问"><!--[--><!--]--> 我要提问 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><li class="dropdown-subitem"><a href="/eurynome-cloud/others/README.md" class="nav-link" aria-label="常见问题"><!--[--><!--]--> 常见问题 <!--[--><!--]--></a></li><li class="dropdown-subitem"><a href="/eurynome-cloud/others/更新日志.md" class="nav-link" aria-label="更新日志"><!--[--><!--]--> 更新日志 <!--[--><!--]--></a></li><li class="dropdown-subitem"><a class="nav-link external" href="https://jq.qq.com/?_wv=1027&amp;k=bIerJVy8" rel="noopener noreferrer" target="_blank" aria-label="加入QQ群"><!--[--><!--]--> 加入QQ群 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><!--]--></ul><!--]--></li><!--]--></ul><!--]--></div></div><div class="navbar-links-item"><div class="dropdown-wrapper"><button class="dropdown-title" type="button" aria-label="Gitee"><span class="title">Gitee</span><span class="arrow down"></span></button><button class="mobile-dropdown-title" type="button" aria-label="Gitee"><span class="title">Gitee</span><span class="right arrow"></span></button><!--[--><ul style="display:none;" class="nav-dropdown"><!--[--><li class="dropdown-item"><a class="nav-link external" href="https://gitee.com/herodotus/eurynome-cloud" rel="noopener noreferrer" target="_blank" aria-label="后端源码"><!--[--><!--]--> 后端源码 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><li class="dropdown-item"><a class="nav-link external" href="https://gitee.com/herodotus/eurynome-cloud-ui" rel="noopener noreferrer" target="_blank" aria-label="前端源码"><!--[--><!--]--> 前端源码 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><li class="dropdown-item"><a class="nav-link external" href="https://gitee.com/herodotus/herodotus-cloud-athena" rel="noopener noreferrer" target="_blank" aria-label="单体版源码"><!--[--><!--]--> 单体版源码 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><!--]--></ul><!--]--></div></div><div class="navbar-links-item"><div class="dropdown-wrapper"><button class="dropdown-title" type="button" aria-label="Github"><span class="title">Github</span><span class="arrow down"></span></button><button class="mobile-dropdown-title" type="button" aria-label="Github"><span class="title">Github</span><span class="right arrow"></span></button><!--[--><ul style="display:none;" class="nav-dropdown"><!--[--><li class="dropdown-item"><a class="nav-link external" href="https://github.com/herodotus-cloud/eurynome-cloud" rel="noopener noreferrer" target="_blank" aria-label="后端源码"><!--[--><!--]--> 后端源码 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><li class="dropdown-item"><a class="nav-link external" href="https://github.com/herodotus-cloud/eurynome-cloud-ui" rel="noopener noreferrer" target="_blank" aria-label="前端源码"><!--[--><!--]--> 前端源码 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><li class="dropdown-item"><a class="nav-link external" href="https://github.com/herodotus-cloud/herodotus-cloud-athena" rel="noopener noreferrer" target="_blank" aria-label="单体版源码"><!--[--><!--]--> 单体版源码 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><!--]--></ul><!--]--></div></div><!--]--></nav><!--[--><!--]--><button class="toggle-dark-button" title="toggle dark mode"><svg style="" class="icon" focusable="false" viewBox="0 0 32 32"><path d="M16 12.005a4 4 0 1 1-4 4a4.005 4.005 0 0 1 4-4m0-2a6 6 0 1 0 6 6a6 6 0 0 0-6-6z" fill="currentColor"></path><path d="M5.394 6.813l1.414-1.415l3.506 3.506L8.9 10.318z" fill="currentColor"></path><path d="M2 15.005h5v2H2z" fill="currentColor"></path><path d="M5.394 25.197L8.9 21.691l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 25.005h2v5h-2z" fill="currentColor"></path><path d="M21.687 23.106l1.414-1.415l3.506 3.506l-1.414 1.414z" fill="currentColor"></path><path d="M25 15.005h5v2h-5z" fill="currentColor"></path><path d="M21.687 8.904l3.506-3.506l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 2.005h2v5h-2z" fill="currentColor"></path></svg><svg style="display:none;" class="icon" focusable="false" viewBox="0 0 32 32"><path d="M13.502 5.414a15.075 15.075 0 0 0 11.594 18.194a11.113 11.113 0 0 1-7.975 3.39c-.138 0-.278.005-.418 0a11.094 11.094 0 0 1-3.2-21.584M14.98 3a1.002 1.002 0 0 0-.175.016a13.096 13.096 0 0 0 1.825 25.981c.164.006.328 0 .49 0a13.072 13.072 0 0 0 10.703-5.555a1.01 1.01 0 0 0-.783-1.565A13.08 13.08 0 0 1 15.89 4.38A1.015 1.015 0 0 0 14.98 3z" fill="currentColor"></path></svg></button><form class="search-box" role="search"><input type="search" placeholder="搜索" autocomplete="off" spellcheck="false" value><!----></form></div></header><div class="sidebar-mask"></div><aside class="sidebar"><nav class="navbar-links"><!--[--><div class="navbar-links-item"><a href="/eurynome-cloud/documents/" class="nav-link router-link-active" aria-label="指南"><!--[--><!--]--> 指南 <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/eurynome-cloud/documents-athena/" class="nav-link" aria-label="单体版"><!--[--><!--]--> 单体版 <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/eurynome-cloud/microservices/" class="nav-link" aria-label="微服务技术栈"><!--[--><!--]--> 微服务技术栈 <!--[--><!--]--></a></div><div class="navbar-links-item"><div class="dropdown-wrapper"><button class="dropdown-title" type="button" aria-label="了解更多"><span class="title">了解更多</span><span class="arrow down"></span></button><button class="mobile-dropdown-title" type="button" aria-label="了解更多"><span class="title">了解更多</span><span class="right arrow"></span></button><!--[--><ul style="display:none;" class="nav-dropdown"><!--[--><li class="dropdown-item"><!--[--><h4 class="dropdown-subtitle"><span>延伸</span></h4><ul class="dropdown-subitem-wrapper"><!--[--><li class="dropdown-subitem"><a href="/eurynome-cloud/basic-knowledge/" class="nav-link" aria-label="了解基础知识"><!--[--><!--]--> 了解基础知识 <!--[--><!--]--></a></li><!--]--></ul><!--]--></li><li class="dropdown-item"><!--[--><h4 class="dropdown-subtitle"><span>帮助</span></h4><ul class="dropdown-subitem-wrapper"><!--[--><li class="dropdown-subitem"><a class="nav-link external" href="https://gitee.com/herodotus/eurynome-cloud/issues" rel="noopener noreferrer" target="_blank" aria-label="我要提问"><!--[--><!--]--> 我要提问 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><li class="dropdown-subitem"><a href="/eurynome-cloud/others/README.md" class="nav-link" aria-label="常见问题"><!--[--><!--]--> 常见问题 <!--[--><!--]--></a></li><li class="dropdown-subitem"><a href="/eurynome-cloud/others/更新日志.md" class="nav-link" aria-label="更新日志"><!--[--><!--]--> 更新日志 <!--[--><!--]--></a></li><li class="dropdown-subitem"><a class="nav-link external" href="https://jq.qq.com/?_wv=1027&amp;k=bIerJVy8" rel="noopener noreferrer" target="_blank" aria-label="加入QQ群"><!--[--><!--]--> 加入QQ群 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><!--]--></ul><!--]--></li><!--]--></ul><!--]--></div></div><div class="navbar-links-item"><div class="dropdown-wrapper"><button class="dropdown-title" type="button" aria-label="Gitee"><span class="title">Gitee</span><span class="arrow down"></span></button><button class="mobile-dropdown-title" type="button" aria-label="Gitee"><span class="title">Gitee</span><span class="right arrow"></span></button><!--[--><ul style="display:none;" class="nav-dropdown"><!--[--><li class="dropdown-item"><a class="nav-link external" href="https://gitee.com/herodotus/eurynome-cloud" rel="noopener noreferrer" target="_blank" aria-label="后端源码"><!--[--><!--]--> 后端源码 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><li class="dropdown-item"><a class="nav-link external" href="https://gitee.com/herodotus/eurynome-cloud-ui" rel="noopener noreferrer" target="_blank" aria-label="前端源码"><!--[--><!--]--> 前端源码 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><li class="dropdown-item"><a class="nav-link external" href="https://gitee.com/herodotus/herodotus-cloud-athena" rel="noopener noreferrer" target="_blank" aria-label="单体版源码"><!--[--><!--]--> 单体版源码 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><!--]--></ul><!--]--></div></div><div class="navbar-links-item"><div class="dropdown-wrapper"><button class="dropdown-title" type="button" aria-label="Github"><span class="title">Github</span><span class="arrow down"></span></button><button class="mobile-dropdown-title" type="button" aria-label="Github"><span class="title">Github</span><span class="right arrow"></span></button><!--[--><ul style="display:none;" class="nav-dropdown"><!--[--><li class="dropdown-item"><a class="nav-link external" href="https://github.com/herodotus-cloud/eurynome-cloud" rel="noopener noreferrer" target="_blank" aria-label="后端源码"><!--[--><!--]--> 后端源码 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><li class="dropdown-item"><a class="nav-link external" href="https://github.com/herodotus-cloud/eurynome-cloud-ui" rel="noopener noreferrer" target="_blank" aria-label="前端源码"><!--[--><!--]--> 前端源码 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><li class="dropdown-item"><a class="nav-link external" href="https://github.com/herodotus-cloud/herodotus-cloud-athena" rel="noopener noreferrer" target="_blank" aria-label="单体版源码"><!--[--><!--]--> 单体版源码 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></li><!--]--></ul><!--]--></div></div><!--]--></nav><!--[--><!--]--><ul class="sidebar-links"><!--[--><!--[--><p class="sidebar-heading sidebar-item">指南</p><ul class=""><li><!--[--><a href="/eurynome-cloud/documents/" class="nav-link router-link-active sidebar-item" aria-label="介绍"><!--[--><!--]--> 介绍 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a href="/eurynome-cloud/documents/%E5%BF%AB%E9%80%9F%E4%BA%86%E8%A7%A3.html" class="nav-link sidebar-item" aria-label="快速了解"><!--[--><!--]--> 快速了解 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a href="/eurynome-cloud/documents/%E9%A1%B9%E7%9B%AE%E4%BB%8B%E7%BB%8D.html" class="nav-link sidebar-item" aria-label="项目介绍"><!--[--><!--]--> 项目介绍 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a href="/eurynome-cloud/documents/%E7%8E%AF%E5%A2%83%E9%83%A8%E7%BD%B2.html" class="nav-link sidebar-item" aria-label="环境部署"><!--[--><!--]--> 环境部署 <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--><!--[--><p class="sidebar-heading sidebar-item active">后端手册</p><ul class=""><li><!--[--><a href="/eurynome-cloud/documents/%E6%95%B0%E6%8D%AE%E5%88%9D%E5%A7%8B%E5%8C%96.html" class="nav-link sidebar-item" aria-label="数据初始化"><!--[--><!--]--> 数据初始化 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a href="/eurynome-cloud/documents/%E6%9B%B4%E6%8D%A2%E6%95%B0%E6%8D%AE%E5%BA%93.html" class="nav-link sidebar-item" aria-label="更换数据库"><!--[--><!--]--> 更换数据库 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/eurynome-cloud/documents/%E5%A4%9A%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE.html" class="router-link-active router-link-exact-active nav-link router-link-active sidebar-item active" aria-label="多环境配置"><!--[--><!--]--> 多环境配置 <!--[--><!--]--></a><ul class="sidebar-sub-items"><li><!--[--><a aria-current="page" href="/eurynome-cloud/documents/%E5%A4%9A%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE.html#什么是多环境配置" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="什么是多环境配置？"><!--[--><!--]--> 什么是多环境配置？ <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/eurynome-cloud/documents/%E5%A4%9A%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE.html#maven-多环境配置" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Maven 多环境配置"><!--[--><!--]--> Maven 多环境配置 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/eurynome-cloud/documents/%E5%A4%9A%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE.html#spring-boot-多环境配置" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Spring Boot 多环境配置"><!--[--><!--]--> Spring Boot 多环境配置 <!--[--><!--]--></a><ul class="sidebar-sub-items"><li><!--[--><a aria-current="page" href="/eurynome-cloud/documents/%E5%A4%9A%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE.html#spring-boot-环境设置机制" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Spring Boot 环境设置机制"><!--[--><!--]--> Spring Boot 环境设置机制 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/eurynome-cloud/documents/%E5%A4%9A%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE.html#配置多环境" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="配置多环境"><!--[--><!--]--> 配置多环境 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/eurynome-cloud/documents/%E5%A4%9A%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE.html#指定环境" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="指定环境"><!--[--><!--]--> 指定环境 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/eurynome-cloud/documents/%E5%A4%9A%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE.html#单一文件写法" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="单一文件写法"><!--[--><!--]--> 单一文件写法 <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li><li><!--[--><a aria-current="page" href="/eurynome-cloud/documents/%E5%A4%9A%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE.html#nacos-多环境配置" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Nacos 多环境配置"><!--[--><!--]--> Nacos 多环境配置 <!--[--><!--]--></a><ul class="sidebar-sub-items"><li><!--[--><a aria-current="page" href="/eurynome-cloud/documents/%E5%A4%9A%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE.html#data-id" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Data Id"><!--[--><!--]--> Data Id <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/eurynome-cloud/documents/%E5%A4%9A%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE.html#group" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Group"><!--[--><!--]--> Group <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/eurynome-cloud/documents/%E5%A4%9A%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE.html#namespace" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Namespace"><!--[--><!--]--> Namespace <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li><li><!--[--><a aria-current="page" href="/eurynome-cloud/documents/%E5%A4%9A%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE.html#docker和k8s-多环境配置" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Docker和K8S 多环境配置"><!--[--><!--]--> Docker和K8S 多环境配置 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/eurynome-cloud/documents/%E5%A4%9A%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE.html#eurynome-cloud-的多环境配置" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Eurynome Cloud 的多环境配置"><!--[--><!--]--> Eurynome Cloud 的多环境配置 <!--[--><!--]--></a><ul class="sidebar-sub-items"><li><!--[--><a aria-current="page" href="/eurynome-cloud/documents/%E5%A4%9A%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE.html#eurynome-cloud-中的maven多环境配置" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Eurynome Cloud 中的Maven多环境配置"><!--[--><!--]--> Eurynome Cloud 中的Maven多环境配置 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/eurynome-cloud/documents/%E5%A4%9A%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE.html#eurynome-cloud-中的spring-boot和nacos多环境配置" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Eurynome Cloud 中的Spring Boot和Nacos多环境配置"><!--[--><!--]--> Eurynome Cloud 中的Spring Boot和Nacos多环境配置 <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li></ul><!--]--></li><li><!--[--><a href="/eurynome-cloud/documents/%E6%96%B0%E5%BB%BA%E5%AD%90%E6%A8%A1%E5%9D%97.html" class="nav-link sidebar-item" aria-label="新建子模块"><!--[--><!--]--> 新建子模块 <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--><!--[--><p class="sidebar-heading sidebar-item">前端手册</p><ul class=""><li><!--[--><a href="/eurynome-cloud/documents/%E5%89%8D%E7%AB%AF%E6%89%8B%E5%86%8C.html" class="nav-link sidebar-item" aria-label="前端手册"><!--[--><!--]--> 前端手册 <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--><!--]--></ul><!--[--><!--]--></aside><!--[--><main class="page"><!--[--><!--]--><div class="theme-default-content"><!--[--><h1 id="多环境配置" tabindex="-1"><a class="header-anchor" href="#多环境配置" aria-hidden="true">#</a> 多环境配置</h1><h2 id="什么是多环境配置" tabindex="-1"><a class="header-anchor" href="#什么是多环境配置" aria-hidden="true">#</a> 什么是多环境配置？</h2><p>在实际项目开发过程中，我们往往需要区分开发，测试，联调、预发布，生产等不同的应用环境。这些应用环境用途不同，对应环境的配置项、稳定性、数据质量、保障性、可接触人群等要求也不同，比如Swagger一般上在生产时是关闭的；不同环境数据库地址、端口号等都是不尽相同的。要是没有多环境的自由切换，部署起来是很繁琐也容易出错的。</p><p>使用多环境配置，可以针对不同的应用环境，提前配置好对应的环境配置信息。在使用时，仅需要修改具体的环境名称，就可以把对应环境配置信息、系统参数等相关内容全部切换。不仅使用便捷，还极大地降低了手工修改参数的出错率。</p><h2 id="maven-多环境配置" tabindex="-1"><a class="header-anchor" href="#maven-多环境配置" aria-hidden="true">#</a> Maven 多环境配置</h2><p>使用<code>Maven</code>可以通过在<code>pom.xml</code>中增加<code>&lt;profiles&gt;</code>配置进行多环境的配置。参见以下示例：</p><div class="language-yaml ext-yml line-numbers-mode"><pre class="language-yaml"><code>&lt;profiles<span class="token punctuation">&gt;</span>
    &lt;profile<span class="token punctuation">&gt;</span>
        &lt;id<span class="token punctuation">&gt;</span>development&lt;/id<span class="token punctuation">&gt;</span>
        &lt;activation<span class="token punctuation">&gt;</span>
            &lt;activeByDefault<span class="token punctuation">&gt;</span>true&lt;/activeByDefault<span class="token punctuation">&gt;</span>
        &lt;/activation<span class="token punctuation">&gt;</span>
        &lt;properties<span class="token punctuation">&gt;</span>
            <span class="token punctuation">...</span>
        &lt;/properties<span class="token punctuation">&gt;</span>
    &lt;/profile<span class="token punctuation">&gt;</span>
    &lt;profile<span class="token punctuation">&gt;</span>
        &lt;id<span class="token punctuation">&gt;</span>produtction&lt;/id<span class="token punctuation">&gt;</span>
        &lt;properties<span class="token punctuation">&gt;</span>
            <span class="token punctuation">...</span>
        &lt;/properties<span class="token punctuation">&gt;</span>
    &lt;/profile<span class="token punctuation">&gt;</span>
    &lt;profile<span class="token punctuation">&gt;</span>
        &lt;id<span class="token punctuation">&gt;</span>testing&lt;/id<span class="token punctuation">&gt;</span>
        &lt;properties<span class="token punctuation">&gt;</span>
            <span class="token punctuation">...</span>
        &lt;/properties<span class="token punctuation">&gt;</span>
    &lt;/profile<span class="token punctuation">&gt;</span>
&lt;/profiles<span class="token punctuation">&gt;</span>
</code></pre><div class="line-numbers"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br></div></div><p>通过下面配置就可以指定当前默认的环境是哪个</p><div class="language-yaml ext-yml line-numbers-mode"><pre class="language-yaml"><code>&lt;activation<span class="token punctuation">&gt;</span>
    &lt;activeByDefault<span class="token punctuation">&gt;</span>true&lt;/activeByDefault<span class="token punctuation">&gt;</span>
&lt;/activation<span class="token punctuation">&gt;</span>
</code></pre><div class="line-numbers"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><p>在开发和使用过程中，必须要配置一个默认的环境。配置完成之后，在IDE中也会提供可操作性界面进行操作。下图即为IDEA的界面示例：</p><p><img src="/eurynome-cloud/images/idea/profiles.png" alt="profiles"></p><h2 id="spring-boot-多环境配置" tabindex="-1"><a class="header-anchor" href="#spring-boot-多环境配置" aria-hidden="true">#</a> Spring Boot 多环境配置</h2><h3 id="spring-boot-环境设置机制" tabindex="-1"><a class="header-anchor" href="#spring-boot-环境设置机制" aria-hidden="true">#</a> Spring Boot 环境设置机制</h3><p><code>spring.profiles.active</code> 属性可以为我们指定当前设置的环境，以此来选择我们的配置文件。例如我们有配置文件</p><ul><li>application.yml</li><li>application-dev.yml</li><li>application-test.yml</li><li>application-prod.yml</li></ul><p>当执行 <code>java -jar xxx.jar --spring.profiles.actvie=test</code> 此时，系统将启用 <code>application.yml</code> 和 <code>application-test.yml</code> 配置文件。</p><p>当执行 <code>java -jar xxx.jar --spring.profiles.actvie=prod</code> 此时，系统将启用 <code>application.yml</code> 和 <code>application-prod.yml</code> 配置文件。</p><p>正是这种配置参数可以决定我们使用哪种配置文件，如果我们把不同环境的配置写在对应的配置文件中，我们就可以实现多环境机制。</p><h3 id="配置多环境" tabindex="-1"><a class="header-anchor" href="#配置多环境" aria-hidden="true">#</a> 配置多环境</h3><p>正如上一点所述，我们配置不同的配置文件</p><ul><li>application.yml</li><li>application-dev.yml（开发环境）</li><li>application-test.yml（测试环境）</li><li>application-uat.yml（预发布环境）</li><li>application-prod.yml（生产环境）</li></ul><h3 id="指定环境" tabindex="-1"><a class="header-anchor" href="#指定环境" aria-hidden="true">#</a> 指定环境</h3><ul><li>在 cmd 命令中指定</li></ul><div class="language-cmd ext-cmd line-numbers-mode"><pre class="language-cmd"><code>java -jar xxx.jar --spring.profiles.actvie=dev 
</code></pre><div class="line-numbers"><span class="line-number">1</span><br></div></div><ul><li>在 <code>application.yml</code> 中指定</li></ul><div class="language-yaml ext-yml line-numbers-mode"><pre class="language-yaml"><code><span class="token key atrule">spring</span><span class="token punctuation">:</span>
  <span class="token key atrule">profiles</span><span class="token punctuation">:</span>
    <span class="token key atrule">active</span><span class="token punctuation">:</span> dev
</code></pre><div class="line-numbers"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><ul><li>在IDEA 编辑器中指定</li></ul><p>在运行按钮（绿色三角形按钮）旁边选择 <code>Edit Configurations...</code>，在弹出的对话框中 <code>Active profiles</code> 输入 <code>dev</code> 或其他即可。</p><div class="custom-container warning"><p class="custom-container-title">注意</p><p>这种方法只有在本地调试的时候才生效。</p></div><h3 id="单一文件写法" tabindex="-1"><a class="header-anchor" href="#单一文件写法" aria-hidden="true">#</a> 单一文件写法</h3><div class="language-yaml ext-yml line-numbers-mode"><pre class="language-yaml"><code><span class="token key atrule">spring</span><span class="token punctuation">:</span>
  <span class="token key atrule">application</span><span class="token punctuation">:</span>
    <span class="token key atrule">name</span><span class="token punctuation">:</span>  @artifactId@
  <span class="token key atrule">profiles</span><span class="token punctuation">:</span>
    <span class="token key atrule">active</span><span class="token punctuation">:</span> develpment
<span class="token punctuation">...</span>

<span class="token punctuation">---</span>
<span class="token comment"># 开发环境配置</span>
<span class="token key atrule">spring</span><span class="token punctuation">:</span>
  <span class="token key atrule">config</span><span class="token punctuation">:</span>
    <span class="token key atrule">activate</span><span class="token punctuation">:</span>
      <span class="token key atrule">on-profile</span><span class="token punctuation">:</span> develpment

<span class="token punctuation">---</span>
<span class="token comment"># 生产环境配置</span>
<span class="token key atrule">spring</span><span class="token punctuation">:</span>
  <span class="token key atrule">config</span><span class="token punctuation">:</span>
    <span class="token key atrule">activate</span><span class="token punctuation">:</span>
      <span class="token key atrule">on-profile</span><span class="token punctuation">:</span> production
</code></pre><div class="line-numbers"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br></div></div><h2 id="nacos-多环境配置" tabindex="-1"><a class="header-anchor" href="#nacos-多环境配置" aria-hidden="true">#</a> Nacos 多环境配置</h2><p>本身没有提供统一的多环境管理。在Nacos中，本身有多个不同管理级别的概念，包括：Data ID、Group、Namespace。只要利用好这些层级概念的关系，就可以根据自己的需要来实现多环境的管理。</p><h3 id="data-id" tabindex="-1"><a class="header-anchor" href="#data-id" aria-hidden="true">#</a> Data Id</h3><ol><li><code>Data Id</code>的默认值为<code>${spring.cloud.nacos.config.prefix}-${spring.profile.active}.${spring.cloud.nacos.config.file-extension}</code></li><li><code>spring.cloud.nacos.config.prefix</code>的默认值为<code>${spring.application.name}</code></li><li><code>spring.cloud.nacos.config.file-extension</code>的默认值为<code>properties</code></li><li>当<code>spring.profiles.active</code>未配置时，则匹配<code>${spring.application.name}.properties</code></li><li>若设置了<code>spring.profiles.active</code>而<code>Nacos</code>中存在<code>${spring.application.name}.properties</code>时，若还存在</li><li><code>${spring.application.name}-${spring.profiles.active}.properties</code>，则默认匹配后者，若不存在，则会自动匹配前者 由于<code>Nacos</code>建议且默认用<code>spring.application.name</code>作为<code>Data Id</code>的前缀，若要在不同服务中共享项目统一配置，则可以通过配置<code>spring.cloud.nacos.config.shared-dataids</code>或<code>spring.cloud.nacos.config.refreshable-dataids</code>来添加共享配置，前者不支持自动刷新，后者支持</li></ol><h3 id="group" tabindex="-1"><a class="header-anchor" href="#group" aria-hidden="true">#</a> Group</h3><p><code>Group</code>是一个很灵活的配置项，并没有固定的规定，可以用作多环境、多模块、多版本之间区分配置</p><h3 id="namespace" tabindex="-1"><a class="header-anchor" href="#namespace" aria-hidden="true">#</a> Namespace</h3><p>使用命名空间来区分不同环境的配置，因为使用<code>profiles</code>或<code>group</code>会是不同环境的配置展示到一个页面，而<code>Nacos</code>控制台对不同的<code>Namespace</code>做了<code>Tab</code>栏分组展示</p><p><img src="/eurynome-cloud/images/nacos/namespaces-tab.png" alt="Namespaces Tab"></p><p>创建方式如下图所示</p><p><img src="/eurynome-cloud/images/nacos/namespaces-create.png" alt="Namespaces Create"></p><div class="custom-container danger"><p class="custom-container-title">注意</p><p>配置Namespace的时候不是通过名称，而是通过命名空间的ID(上图所示)，可通过如下配置来设置服务使用的命名空间</p></div><div class="language-xml ext-xml line-numbers-mode"><pre class="language-xml"><code><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>profile</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>id</span><span class="token punctuation">&gt;</span></span>docker<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>id</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>properties</span><span class="token punctuation">&gt;</span></span>
        <span class="token comment">&lt;!--当前环境--&gt;</span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>profile.name</span><span class="token punctuation">&gt;</span></span>docker<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>profile.name</span><span class="token punctuation">&gt;</span></span>
        <span class="token comment">&lt;!--数据库类型--&gt;</span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>database.type</span><span class="token punctuation">&gt;</span></span>postgresql<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>database.type</span><span class="token punctuation">&gt;</span></span>
        <span class="token comment">&lt;!--代码构建控制--&gt;</span>
        <span class="token comment">&lt;!--跳过构建源代码包--&gt;</span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>skip.build.source.package</span><span class="token punctuation">&gt;</span></span>false<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>skip.build.source.package</span><span class="token punctuation">&gt;</span></span>
        <span class="token comment">&lt;!--不copy代码包到docker构建目录--&gt;</span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>skip.copy.docker.resource</span><span class="token punctuation">&gt;</span></span>false<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>skip.copy.docker.resource</span><span class="token punctuation">&gt;</span></span>
        <span class="token comment">&lt;!--不执行git commit 构建--&gt;</span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>skip.build.git.commit.info</span><span class="token punctuation">&gt;</span></span>false<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>skip.build.git.commit.info</span><span class="token punctuation">&gt;</span></span>
        <span class="token comment">&lt;!--Nacos配置中心地址--&gt;</span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>config.server-addr</span><span class="token punctuation">&gt;</span></span>192.168.101.10:8848<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>config.server-addr</span><span class="token punctuation">&gt;</span></span>
        <span class="token comment">&lt;!--Nacos配置中心命名空间,用于支持多环境.这里必须使用ID，不能使用名称,默认为空--&gt;</span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>config.namespace</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>config.namespace</span><span class="token punctuation">&gt;</span></span>
        <span class="token comment">&lt;!--Nacos服务发现地址--&gt;</span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>discovery.server-addr</span><span class="token punctuation">&gt;</span></span>192.168.101.10:8848<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>discovery.server-addr</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>sentinel.server-addr</span><span class="token punctuation">&gt;</span></span>192.168.101.10:8858<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>sentinel.server-addr</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>properties</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>profile</span><span class="token punctuation">&gt;</span></span>
</code></pre><div class="line-numbers"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br></div></div><h2 id="docker和k8s-多环境配置" tabindex="-1"><a class="header-anchor" href="#docker和k8s-多环境配置" aria-hidden="true">#</a> Docker和K8S 多环境配置</h2><p><code>Docker</code>和<code>K8S</code>的多环境，因为不同使用者使用的方式不同，<strong>Eurynome Cloud</strong> 并没有过多涉及。<strong>Eurynome Cloud</strong> 中，也简单定义了自己<code>Docker</code>多环境，涉及<code>production</code>和<code>development</code>两个环境，主要区别是<code>production</code>环境docker打包会包含<code>Skywalking Agent</code>，而<code>development</code>环境docker打包只会包含应用，通过执行不同的<code>docker-compose</code>文件进行区分仅此而已。如果不使用<code>Skywalking</code>，使用<code>development</code>环境打包docker即可。</p><h2 id="eurynome-cloud-的多环境配置" tabindex="-1"><a class="header-anchor" href="#eurynome-cloud-的多环境配置" aria-hidden="true">#</a> Eurynome Cloud 的多环境配置</h2><p>微服务架构涉及多方面内容，<strong>Eurynome Cloud</strong>的为解决多环境，综合使用<code>Maven</code>、<code>Spring Boot</code>以及<code>Nacos</code>多环境的特点，以支持微服务的多环境切换和多种数据库的配置支持。</p><h3 id="eurynome-cloud-中的maven多环境配置" tabindex="-1"><a class="header-anchor" href="#eurynome-cloud-中的maven多环境配置" aria-hidden="true">#</a> Eurynome Cloud 中的Maven多环境配置</h3><p><strong>Eurynome Cloud</strong> Maven 多环境配置，在工程根目录下的<code>pom.xml</code>中进行配置。这里的环境配置主要解决以下问题：</p><ol><li><strong>传递参数</strong>：传递<code>&lt;profile.name&gt;</code>和<code>&lt;database.type&gt;</code>两个参数。</li></ol><ul><li><code>&lt;profile.name&gt;</code>的值传递至<code>bootstrap.yml</code>中，这样就可以联动使用<code>Spring Boot</code>和<code>Nacos</code>的多环境配置；</li><li><code>&lt;database.type&gt;</code>参数，传递至<code>bootstrap.yml</code>中，用于指定具体使用的数据库配置</li></ul><ol start="2"><li><strong>Dashboard</strong>：通过<code>&lt;skip.build.source.package&gt;</code>、<code>&lt;skip.copy.docker.resource&gt;</code>和<code>&lt;skip.build.git.commit.info&gt;</code>三个参数进行打包控制。</li></ol><ul><li><code>&lt;skip.build.source.package&gt;</code> 控制是否构建源代码包：构建源代码包便于调试<code>eurynome-cloud-athena</code>的调试。</li><li><code>&lt;skip.copy.docker.resource&gt;</code> 控制是否拷贝服务jar包：编译完成后，将可执行额外操作，将服务jar包拷贝到统一的docker build context下，使用统一配置build docker，这样就不必每一个服务都编写<code>Dockerfile</code></li><li><code>&lt;skip.build.git.commit.info&gt;</code> 控制是否生成Git信息：是否将Git commit等相关信息在编译打包时，写入到jar包中。写入Git commit等相关信息，可以便于在运维过程中快速区分不同jar对应的提交信息、编译、开发者等相关信息。</li></ul><ol start="3"><li><strong><code>Nacos</code> 和 <code>Sentinel Dashboard</code>地址指定</strong>：</li></ol><p>指定不同环境下<code>Nacos</code>配置中心、服务发现和<code>Sentinel Dashboard</code>的地址，<code>Nacos</code>配置中心、服务发现地址无法写在<code>Nacos</code>的配置中，所以在此处进行设置。</p><h3 id="eurynome-cloud-中的spring-boot和nacos多环境配置" tabindex="-1"><a class="header-anchor" href="#eurynome-cloud-中的spring-boot和nacos多环境配置" aria-hidden="true">#</a> Eurynome Cloud 中的Spring Boot和Nacos多环境配置</h3><ul><li>通过<code>Spring Boot</code>的<code>profiles</code>机制，实现<code>Spring Boot</code>与<code>Nacos</code>的联动。</li><li>利用<code>Nacos</code>的<code>Group</code>信息，实现<code>Nacos</code>配置的多环境。<code>${project_home}/platform/eurynome-cloud-management/resources/configs</code>目录下，还有一级目录。这级目录的名称，是对应<code>Nacos</code>中的<code>Group</code>。所以在向<code>Nacos</code>导入配置时，一定要注意<code>Group</code>的创建和匹配。切勿全部导入到<code>DEFAULT</code>组下，这样会导致无法正常运行。</li></ul><!--]--></div><footer class="page-meta"><!----><div class="meta-item last-updated"><span class="meta-item-label">更新时间: </span><span class="meta-item-info">2021/9/7 下午2:44:55</span></div><div class="meta-item contributors"><span class="meta-item-label">贡献者: </span><span class="meta-item-info"><!--[--><!--[--><span class="contributor" title="email: pointer_v@qq.com">herodotus</span><!----><!--]--><!--]--></span></div></footer><nav class="page-nav"><p class="inner"><span class="prev"> ← <a href="/eurynome-cloud/documents/%E6%9B%B4%E6%8D%A2%E6%95%B0%E6%8D%AE%E5%BA%93.html" class="nav-link" aria-label="更换数据库"><!--[--><!--]--> 更换数据库 <!--[--><!--]--></a></span><span class="next"><a href="/eurynome-cloud/documents/%E6%96%B0%E5%BB%BA%E5%AD%90%E6%A8%A1%E5%9D%97.html" class="nav-link" aria-label="新建子模块"><!--[--><!--]--> 新建子模块 <!--[--><!--]--></a> → </span></p></nav><!--[--><!--]--></main><!--]--></div><!----><!--]--></div>
    <script src="/eurynome-cloud/assets/js/runtime~app.64d35c83.js" defer></script><script src="/eurynome-cloud/assets/js/567.94e28fdc.js" defer></script><script src="/eurynome-cloud/assets/js/app.a2a09456.js" defer></script>
  </body>
</html>
